#import <Foundation/Foundation.h>
#import <CoreFoundation/CoreFoundation.h>
#import <UIKit/CDStructures.h>
#import <UIKit/UIApplication.h>
#import <UIKit/UIPushButton.h>
#import <UIKit/UIThreePartButton.h>
#import <UIKit/UINavigationBar.h>
#import <UIKit/UINavigationItem.h>
#import <UIKit/UIWindow.h>
#import <UIKit/UIView.h>
#import <UIKit/UIView-Hierarchy.h>
#import <UIKit/UIHardware.h>
#import <UIKit/UITable.h>
#import <UIKit/UITableCell.h>
#import <UIKit/UITableColumn.h>
#import <UIKit/UIImage.h>
#import <UIKit/UIButtonBar.h>
#import <UIKit/UITextView.h>
#import <UIKit/UIImageView.h>
#import <UIKit/UIKeyboard.h>
#include <unistd.h>
#import "SetBrowser.h"
#import "MFBrowser.h"

@implementation SetBrowser : UIView

- (id) initWithApplication: (UIApplication*)app withAppID: (NSString*)appID withFrame: (struct CGRect)rect
{
	//Init view with frame rect
	[super initWithFrame: rect];
	
	//Save application object for launching other apps
	_app = app;
	_appID = appID;
	
	float navBarWidth = rect.size.width;
	float navBarHeight = 42.0f;
	
	MFBrowser* browser = [[MFBrowser alloc] initWithApplication: app
		withAppID: _appID
		withFrame: CGRectMake(
			0.0f, 
			navBarHeight, 
			rect.size.width, rect.size.height - navBarHeight)];
	
	[browser setDelegate: self];
	[browser openSetsDir];
	
	// Setup Navigation bar
	UINavigationBar* navbar = [[UINavigationBar alloc] initWithFrame: CGRectMake(0.0f, 0.0f, navBarWidth, navBarHeight)];
	UINavigationItem* title = [[UINavigationItem alloc] initWithTitle:@"iStudy"];
	[navbar pushNavigationItem:title];
	[navbar setBarStyle: 0];
	[navbar enableAnimation];
	
	[self addSubview:navbar];
	[self addSubview:browser];
	
	return self;

}

@end